package com.trg.designmodel.prototype.improve;

/**
 * @ClassName: Sheep
 * @Description: 克隆羊问题---改进后，使用原型模式
 * @Author: tangrg
 * @Date: 2021/7/2 9:02
 * @Version: 1.0
 * @Return:
 **/
public class Sheep implements Cloneable{
    String neme;
    int age;
    String color;


    public Sheep(String neme, int age, String color) {
        this.neme = neme;
        this.age = age;
        this.color = color;
    }

    public String getNeme() {
        return neme;
    }

    public void setNeme(String neme) {
        this.neme = neme;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    @Override
    public String toString() {
        return "Sheep{" +
                "neme='" + neme + '\'' +
                ", age=" + age +
                ", color='" + color + '\'' +
                '}';
    }

    @Override
    protected Object clone() {
        Sheep sheep = null;
        try {
            sheep = (Sheep) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return sheep;
    }
}
